<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--{include file='comm/header.tpl'}-->
    	<title><!--{$bill_array.bill_code}--> - 订单详情</title>
    <!--{include file='comm/comm_pic.tpl'}-->
</head>
<body>
<div style="width:99%;margin: 0 auto;">


    <div class="title">
        <h2 class="tac">
            <!--{$bill_array.bill_code}--> - 订单详情
            <!--{if isset($temp_array)}-->
            【此订单被订单<a href="/quanliadmin/app/bill/billSearch.pscript?operFlg=9&bill_no=<!--{$temp_array['bill_no']}-->" target="_blank">[<!--{$temp_array['bill_code']}-->]</a>代付】
            <!--{/if}-->
        </h2>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">订单信息</h3>
        </div>
        <div class="panel-body">
            <table class="ebsig-text">
                <tr>
                    <td width="25%">城市：<!--{$bill_array.deliver_city}--></td>
                    <td>订单平台：<!--{$bill_array.billPlatformName}--></td>
                    <td>订单渠道：<!--{$bill_array.billChannelName}--></td>
                    <td>订单类型：<!--{$bill_array.billTypeName}--></td>
                </tr>
                <tr>
                    <td width="25%">订单编号：<!--{$bill_array.bill_code}--></td>
                    <td>订单状态：<!--{$bill_array.bill_status_name}--></td>
                    <td>订单金额：<!--{$bill_array.bill_money|string_format:"%.2f"}--> 元</td>
                    <td>赠送积分：<!--{$bill_array.bill_totalPoints}--></td>
                </tr>
                <tr>
                    <td>支付状态：<!--{$bill_array.pay_status_name}--></td>
                    <td>支付方式：<!--{$bill_array.payTypeName}--></td>
                    <td>运费金额：<!--{$bill_array.deliver_feePaid|string_format:"%.2f"}--> 元  </td>
                    <td>促销渠道：<!--{$bill_promotion}--></td>
                </tr>

                <tr>
                    <td>下单时间：<!--{$bill_array.createTime}--></td>
                    <td>配送日期：<!--{$bill_array.send_date}--></td>
                    <td>配送时间：<!--{$bill_array.send_start_time}--><!--{if isset($bill_array.send_end_time) && $bill_array.send_end_time neq '00:00:00'}--> - <!--{$bill_array.send_end_time}--><!--{/if}--></td>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">客户信息</h3>
        </div>
        <div class="panel-body">
            <table class="ebsig-text">
                <tr>
                    <td width="20%">会员名：<!--{$bill_array.custID}--></td>
                    <td width="20%">会员号：<!--{$bill_array.pcustID}--></td>
                    <td width="20%">会员昵称:<!--{$customer_array.nickName}--></td>
                    <!--add by JunHui.Li FUN-BK-0051 展示会员级别 start-->
                    <td width="20%">会员级别:<!--{$customer_array.rankName}--></td>
                    <td width="20%">会员折扣:<!--{$customer_array.rate}--></td>
                    <!--add by JunHui.Li 20150212 展示会员折扣 end-->
                </tr>
            </table>
        </div>
    </div>
    <!--{if $companyMaster_array}-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">大客户信息</h3>
        </div>
        <div class="panel-body">
            <table class="ebsig-text">
                <tr>
                    <td width="25%">公司名称：<!--{$companyMaster_array.company_name}--></td>
                    <td width="25%">联系人：<!--{$companyMaster_array.connect_name}--></td>
                    <td width="25%">手机号;<!--{$companyMaster_array.mobile}--></td>
                    <td width="25%">电话;<!--{$companyMaster_array.phone}--></td>
                </tr>
                <tr>
                    <td width="25%">公司网址;<!--{$companyMaster_array.website}--></td>
                    <td width="25%">地址;<!--{$companyMaster_array.province_name}--> <!--{$companyMaster_array.city_name}--> <!--{$companyMaster_array.address}--></td>
                    <td>客户企业人数：;<!--{$companyMaster_array.employees_number}--></td>
                    <td>&nbsp;&nbsp;</td>
                </tr>
            </table>
        </div>
    </div>
    <!--{/if}-->

    <!--{if $bill_other_address_pay}-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">异地付款</h3>
        </div>
        <div class="panel-body">
            <table class="ebsig-text">
                <tr>
                    <td width="20%">付款人：<!--{$bill_other_address_pay.custName}--></td>
                    <td width="20%">手机：<!--{$bill_other_address_pay.mobile}--></td>
                    <td width="20%">地址;<!--{$bill_other_address_pay.address}--></td>
                    <td width="20%">收款日期;<!--{$bill_other_address_pay.date}--></td>
                    <td width="20%">收款时间;<!--{$bill_other_address_pay.startTime}-->~<!--{$bill_other_address_pay.endTime}--></td>
                </tr>
            </table>
        </div>
    </div>
    <!--{/if}-->

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">商品信息</h3>
        </div>
        <table class="table table-hover">
            <thead>
            <tr>
                <th width="100">商品编号</th>
                <th width="*" style="text-align: left;">商品名称</th>
                <th width="70" style="text-align: center;">购买数量</th>
                <th width="100" class="tac" style="text-align: center;">规格</th>
                <th width="100" class="tac" style="text-align: center;">标价</th>
                <th width="100" class="tac" style="text-align: center;">实售价</th>
                <th width="220" class="tac" style="text-align: center;">生日牌</th>
                <th width="80" class="tac" style="text-align: center;">切分</th>
                <th width="60" class="tac" style="text-align: center;">配件</th>
                <th width="220" class="tac" style="text-align: center;">生产备注</th>
            </tr>
            </thead>
            <tbody>
            <!--{foreach from=$bill_goods_array item=goods}-->
            <tr>
                <td><!--{$goods.product_code}--></td>
                <td style="text-align: left;"><!--{$goods.goods_name}--></td>
                <td class="tac">1</td>
                <td class="tac"><!--{$goods.goods_spec}--></td>
                <td class="tac"><!--{$goods.goods_storePrice|string_format:"%.2f"}--></td>
                <td class="tac"><!--{$goods.goods_purchasePrice|string_format:"%.2f"}--></td>
                <td class="tac"><!--{$goods.birthday_card}--></td>
                <td class="tac"><!--{if $goods.segmentation eq 0}-->不切分<!--{else}--><!--{$goods.segmentation}--> /份<!--{/if}--></td>
                <td class="tac"><a href="javascript:void(0);" onclick="bill.goods.fittingsList('<!--{$goods.bill_goods_no}-->')">查看</a></td>
                <td class="tac"><!--{$goods.goods_remark}--></td>
            </tr>
            <!--{/foreach}-->
            </tbody>
        </table>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">收货地址</h3>
        </div>
        <div class="panel-body">
            <table class="ebsig-text">
                <tr>
                    <td width="100%">收货人：<!--{$bill_array.deliver_name}--></td>
                </tr>
                <tr>
                    <td width="100%">收货人手机：<!--{$bill_array.deliver_mobile}--></td>
                </tr>
                <tr>
                    <td width="100%">收货地址：<!--{$bill_array.deliver_all_address}--></td>
                </tr>
            </table>
        </div>
    </div>

    <!--{if isset($bill_array.remark)}-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">配送备注</h3>
        </div>
        <div class="panel-body">
            <!--{$bill_array.remark}-->
        </div>
    </div>
    <!--{/if}-->


    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">支付信息</h3>
        </div>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>支付方式</th>
                <th style="text-align: center;">支付金额</th>
                <th style="text-align: center;">已支付金额</th>
                <th style="text-align: center;">支付时间</th>
                <th style="text-align: center;">支付代码</th>
                <th style="text-align: center;">支付状态</th>
            </tr>
            </thead>
            <tbody>
            <!--{foreach from=$bill_pay_array item=pay}-->
                <tr>
                    <td><!--{$pay.payTypeName}--></td>
                    <!--{if $pay.type eq 5}-->
                    <td style="text-align: center;"><!--{$pay.pay_amount/100}--></td>
                    <td style="text-align: center;"><!--{$pay.deduct_amount/100}--></td>
                    <!--{else}-->
                    <td style="text-align: center;"><!--{$pay.pay_amount}--></td>
                    <td style="text-align: center;"><!--{$pay.deduct_amount}--></td>
                    <!--{/if}-->
                    <td style="text-align: center;"><!--{$pay.pay_time}--></td>
                    <td style="text-align: center;"><!--{$pay.pay_code}--></td>
                    <td style="text-align: center;">
                        <!--{if $bill_array.bill_status != 5}-->
                            <!--{if $pay.deduct_amount == $pay.pay_amount}-->
                                已付款
                            <!--{else}-->
                                未付款
                                <!--{if $pay.type == 2 && ($bill_array.pay_status == 0 || $bill_array.pay_status == 2)}-->
                                    <a href="javascript: void(0);" onclick="bill.pay.open(<!--{$pay.payTypeID}-->);">修改</a>
                                <!--{/if}-->
                            <!--{/if}-->
                        <!--{/if}-->
                    </td>
                </tr>
            <!--{/foreach}-->
            </tbody>
        </table>
    </div>


    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">代付订单</h3>
        </div>

        <ul class="list-group">
            <!--{if isset($billPayingAgent)}-->
            <!--{foreach from=$billPayingAgent item=val}-->
            <li class="list-group-item">[<!--{$val.bill_code}-->] <a href="/quanliadmin/app/bill/billSearch.pscript?operFlg=9&bill_no=<!--{$val.bill_no}-->" target="_blank">详情</a></li>
            <!--{/foreach}-->
            <!--{else}-->
            <li class="list-group-item">暂无代付订单</li>
            <!--{/if}-->
        </ul>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">使用优惠券</h3>
        </div>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>优惠券编号</th>
                <th style="text-align: center;">优惠券名称</th>
                <th style="text-align: center;">抵扣金额</th>
                <th style="text-align: center;">使用类型</th>
            </tr>
            </thead>
            <tbody>
            <!--{foreach from=$bill_coupon_array item=coupon}-->
            <tr>
                <td><!--{$coupon.code}--></td>
                <td style="text-align: center;"><!--{$coupon.couponName}--></td>
                <td style="text-align: center;"><!--{$coupon.amount}--></td>
                <td style="text-align: center;">
                    <!--{if $coupon.useType eq 1}-->券
                    <!--{else}-->红包
                    <!--{/if}-->
                </td>
            </tr>
            <!--{/foreach}-->
            </tbody>
        </table>

    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">使用现金卡</h3>
        </div>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>代金卡卡号</th>
                <th style="text-align: center;">代金卡名称</th>
                <th style="text-align: center;">代金卡面值</th>
                <th style="text-align: center;">代金卡抵扣金额</th>
                <th style="text-align: center;">状态</th>
            </tr>
            </thead>
            <tbody>
            <!--{foreach from=$bill_card_array item=card}-->
            <tr>
                <td><!--{$card.card_no}--></td>
                <td style="text-align: center;"><!--{$card.card_name}--></td>
                <td style="text-align: center;"><!--{$card.face_value}--></td>
                <td style="text-align: center;"><!--{$card.deduction}--></td>
                <td style="text-align: center;">
                    <!--{if $card.isUse eq 1}-->
                    使用
                    <!--{elseif $card eq 0}-->
                    取消
                    <!--{else}-->
                    未知
                    <!--{/if}-->
                </td>
            </tr>
            <!--{/foreach}-->
            </tbody>
        </table>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">订单轨迹</h3>
        </div>
        <ul class="list-group">
            <!--{foreach from=$bill_trace_array item=trace}-->
            <li class="list-group-item">[<!--{$trace.createTime}-->] <!--{$trace.content}--></li>
            <!--{/foreach}-->
        </ul>
    </div>

    <!--发票信息-->
    <!--{if $bill_array.invoice == 1}-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">发票信息</h3>
        </div>
        <ul class="list-group">
            <li class="list-group-item">发票类型：<!--{if $bill_array.invoice_type == 1}-->商业零售发票<!--{/if}--></li>
            <li class="list-group-item">抬头类型：<!--{if $bill_array.invoice_title_type == 1}-->个人<!--{else}-->单位<!--{/if}--></li>
            <li class="list-group-item">发票抬头：<!--{$bill_array.invoice_title}--></li>
            <li class="list-group-item">发票金额：<!--{$bill_array.invoice_amount}--></li>
            <li class="list-group-item">发票内容：<!--{$bill_array.invoice_content}--></li>
            <li class="list-group-item">发 票 号：<!--{$bill_array.invoice_number|default:'未开票'}--></li>
        </ul>
    </div>
    <!--{/if}-->

    <!--内部留言-->
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title" style="float: left">内部留言</h3>&nbsp;
            <a href="javascript: void(0);" onclick="bill.display();">[添加]</a></div>
        <ul class="list-group" id="innerWordTb">
            <!--{if $bill_remark_array}-->
                <!--{foreach from=$bill_remark_array item=remark}-->
                    <li class="list-group-item">[<!--{$remark.createTime}-->] <span style="color: #666699;"><!--{$remark.creator}--></span>:&nbsp;<!--{$remark.remark}--></li>
                <!--{/foreach}-->
            <!--{/if}-->
        </ul>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">操作记录</h3>
        </div>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>操作时间</th>
                <th>操作人</th>
                <th>订单信息</th>
                <th>订单商品信息</th>
                <th>订单状态</th>
            </tr>
            </thead>
            <tbody>
            <!--{foreach from=$bill_log_array item=log}-->
                <tr>
                    <td><!--{$log.createTime}--></td>
                    <td><!--{$log.creator}--></td>
                    <td><!--{$log.extend_1}--></td>
                    <td><!--{$log.extend_2}--></td>
                    <td>
                    	<!--mod by yim.hu 20141124 FUN-BK-0035-订单状态优化 --start-->
                        <!--{if $log.extend_5 == 0}-->
                            <!--建立-->
                            未确认
                        <!--{elseif $log.extend_5 == 1}-->
                            已确认
                        <!--{elseif $log.extend_5 == 2}-->
                            <!--已生产-->
                            已打印生产单
                        <!--{elseif $log.extend_5 == 3}-->
                        	<!--已入库-->
                        	已质检入库                           
                        <!--{elseif $log.extend_5 == 4}-->
                            <!--已出库-->
                            已上车
                        <!--{elseif $log.extend_5 == 5}-->
                            <!--配送站收货-->
                            已下车
                        <!--{elseif $log.extend_5 == 6}-->
                            <!--已出仓-->
                        <!--{elseif $log.extend_5 == 7}-->
                            已完成
                        <!--{elseif $log.extend_5 == 10}-->
                            已取消
                        <!--{/if}-->
                        
                        <!--mod by yim.hu 20141124 FUN-BK-0035-订单状态优化 --start-->
                    </td>
                </tr>
            <!--{/foreach}-->
            </tbody>
        </table>
    </div>

    <!--{foreach from=$bill_goods_array item=goods}-->
    <div id="goods_fittings_<!--{$goods.bill_goods_no}-->" style="display: none;">
        <table class="table table-bordered">
            <tr>
                <th style="text-align: center">配件名称</th>
                <th style="text-align: center">单位</th>
                <th style="text-align: center">赠送数量</th>
                <th style="text-align: center">额外购买数量</th>
                <th style="text-align: center">额外购买金额</th>
            </tr>
            <!--{foreach from=$goods.fittings item=fittings}-->
            <tr>
                <td style="text-align: center"><!--{$fittings.fitName}--></td>
                <td style="text-align: center"><!--{$fittings.fitUnit_name}--></td>
                <td style="text-align: center"><!--{$fittings.quantity}--></td>
                <td style="text-align: center"><!--{$fittings.buyNum}--></td>
                <td style="text-align: center"><!--{$fittings.buyMoney}--></td>
            </tr>
            <!--{/foreach}-->
        </table>
    </div>
    <!--{/foreach}-->


    <div id="pay_popup" style="display: none;">
        <form class="form-horizontal" id="pay_form" role="form" onsubmit="return false;">
            <div class="form-group">
                <label for="pay_code" class="col-sm-2 control-label">支付代码</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control w300" id="pay_code" name="pay_code" placeholder="请输入支付代码">
                </div>
            </div>
            <div class="form-group">
                <label for="pay_code" class="col-sm-2 control-label">支付时间</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control w300" id="pay_time" name="pay_time" placeholder="请输入支付时间">
                    <input type="hidden" id="payTypeID" name="payTypeID" />
                </div>
            </div>
        </form>
    </div>

</div>
<script type="text/javascript">
var bill = {

    bill_no: "<!--{$bill_array.bill_no}-->",

    bill_goods_array: "<!--{$bill_goods_array}-->",
    
	display: function() {

        var html = "<form method=\"post\" id=\"messageForm\" name=\"messageForm\">";
        html += "<table>";
        html += "<tr>";
        html += "<td width=\"50\">留言：</td>";
        html += "<td width=\"*\">";
        html += "<textarea class='form-control' id=\"Remark\" name=\"Remark\" style=\"width:300px;height:100px;\"></textarea>";
        html += "</td>";
        html += "</tr>";
        html += "</tbody>";
        html += "</table>";
        html += "</form>";

        E.popup.open({
            title: "添加备注",
            content: html,
            btnName: "保存",
            btnCall: "bill.addInnerWord();",
            css: 'width: 400px;'
        });

	},

	addInnerWord: function() {
		
		//订单留言
		var remark = $('#Remark').val();
		if (!remark) {
			E.alert('请输入留言内容');
			return false;
		}

		$.ajax({
            type: "POST",
            url: "/invokingAjax-backend/bill/bill.ajax?operFlg=2",
            dataType: "JSON",
            data: {
            	remark: remark,
            	bill_no: this.bill_no
            },
            success: function( o ) {
                if (o.code == 200) {
					E.alert('添加成功',2);
                    E.popup.close();
                    var wordHtml = '<li class="list-group-item">[' + o.data.createTime + '] <span style="color: #666699;">'+ o.data.creator + '</span>:&nbsp;' + o.data.remark + '</li>';
                    $('#innerWordTb').append(wordHtml);
                } else {
                    E.alert(o.message);
                }
            }
        });
		
	},

    goods:{

        fittingsList:function( o ){

            var id = "goods_fittings_"+o;
            E.popup.open({
                title: "查看配件",
                id: id,
                btnCall: "bill.addInnerWord();",
                css: 'width: 700px;'
            });

        }

    },


    pay: {

        open: function( payTypeID ) {

            $('#payTypeID').val(payTypeID);

            E.popup.open({
                title: '支付状态修改',
                id: 'pay_popup',
                css: 'width: 600px;',
                btnName: '保存',
                btnCall: 'bill.pay.execute();'
            });

        },

        execute: function() {

            var dt = E.getFormValues('pay_form');
            dt.bill_no = bill.bill_no;

            E.confirm('您确认要该在线支付的支付状态吗？', function() {

                E.loadding.open('正在修改，请稍候...');
                E.ajax_get({
                    url: '/invokingAjax-backend/bill/bill.ajax?operFlg=5',
                    data: dt,
                    call: 'bill.pay.result'
                });

            });

        },

        result: function( o ) {

            E.loadding.close();
            if (o.code == 200) {
                E.alert('支付状态修改成功', 2, 'E.refresh');
            } else {
                E.alert(o.message);
            }

        }

    }

};

</script>
</body>
</html>

